import type { MockMethod } from 'vite-plugin-mock'

import type { requestParams } from './_util'
import { resultSuccess, resultError, getRequestToken } from './_util'

export function createFakeAuthButtonList() {
  return {
    'directives-copy': ['copyTest']
  }
}

export default [
  {
    url: '/mock-api/authButtonList',
    method: 'get',
    response: (request: requestParams) => {
      const token = getRequestToken(request)
      if (!token) return resultError('No token')
      return resultSuccess(createFakeAuthButtonList())
    }
  }
] as MockMethod[]
